BASE_PATH      = $(shell /bin/pwd)/..
PROJECT_NAME   = svnloc
JAVA_CLASSES   = $(BASE_PATH)/classes
JAVA_LIB       = $(BASE_PATH)/lib
JAVA_OUTPUT    = $(BASE_PATH)/bin
JAVA_SOURCE    = $(BASE_PATH)/src
LIBS           = $(wildcard $(JAVA_LIB)/*.jar)
SRC            = $(wildcard $(JAVA_SOURCE)/$(PROJECT_NAME)/*.java)

.PHONY: svnloc


svnloc: $(SRC)
	rm -rf $(JAVA_CLASSES)
	mkdir $(JAVA_CLASSES)
	echo $(SRC)
	(cd $(JAVA_CLASSES) && for file in $(LIBS);do jar xf $$file;done)
	for file in $(SRC);do javac -classpath $(JAVA_CLASSES):$(JAVA_SOURCE) -d $(JAVA_CLASSES) $$file;done
	(cd $(JAVA_CLASSES) && jar cvfm $(JAVA_OUTPUT)/$(PROJECT_NAME).jar $(JAVA_OUTPUT)/MANIFEST.MF $(JAVA_OUTPUT/MANIFEST.MF) *)
	rm -rf $(JAVA_CLASSES)
